home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-10-11 | 2.0 KB | 61 lines | [TEXT/KEEN] |
- # $FindInFolder : hard-set the folderName, /string/ to find,
- # and max number of lines to check below - this will produce
- # a list of all text files which contain the string (full path names).
- # Takes no input, output to stdout. Output is ascii sorted by full path name.
- # Use eg to pick out all source files with a particular revision date near the top.
- # If you run in immediate mode (by holding down the <Shift> key when selecting hAWK)
- # there will be a progress display of the file names.
- # Note since "match" is used, your string can be a regular expression. With plain
- # text, the match counts anywhere on the line, not just at the beginning or at
- # word boundaries. Eg to match a full line exactly except for beginning and ending
- # white space use
- # if (match($0, /^[ \t]*Your plain text here\.[ \t]*$/)) ############### the /string/
- # (remember to escape metacharacters such as ^the period above with a '\')
- # (On a Quadra, looks at about 300 - 500 files a minute)
-
- # Old searches, in storage:
- # "Spot:Moses:" /Oct 6 94 - CodeWarrior happy/
- # "Spot:Apple Sample Code:AppsToGo:"
- # "Spot:Apple Sample Code:AppsToGo:"
-
- BEGIN {
- folderName = "Rodime:DTSDraw:"; ## "Disk:folder:...:folder:...:top folder to search:"
- maxLines = 42; ## set very large if your string is not near tops of files always
-
- ################## enter /string/ to find also, below in ExamineFile ############
-
- DoAFolder(folderName);
- print ""
- print ""
- print "String was found in", numMatched, "files."
- }
-
- function DoAFolder(fldr, i, j, numNested, numFiles, fldrArray, fileArray)
- {
- numNested = nested(fldr, fldrArray);
- numFiles = list(fldr, fileArray);
- for (i = 1; i <= numFiles; ++i)
- ExamineFile(fileArray[i]);
- for (j = 1; j <= numNested; ++j)
- DoAFolder(fldrArray[j]);
- }
-
- function ExamineFile(file, lineCount)
- {
- progress(file);
- lineCount = 1;
- while (getline < file > 0)
- {
- if (match($0, /SetOrigin/)) ############### the /string/
- {
- ++numMatched;
- print file;
- break;
- }
- ##++lineCount;
- ##if (lineCount > maxLines)
- ## break;
- }
- close(file);
- }
-